﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;

using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace subdump
{
    public partial class OpenSubtitlesInfoWindow : Form
    {
        private MainWindow mainWindow;
        private OpenSubtitles osi;
        public OpenSubtitlesInfoWindow(MainWindow mainWindow)
        {
            InitializeComponent();
            this.mainWindow = mainWindow;
            mainWindow.Enabled = false;

            osi = new OpenSubtitles();
            Thread backgroundThread = new Thread(new ThreadStart(osi.loadOpenSubtitlesInfo));
            backgroundThread.Start();
            tmOpenSubtitles.Start();
            

        }

        
        

        private void OpenSubtitlesInfoWindow_FormClosed(object sender, FormClosedEventArgs e)
        {
            mainWindow.Enabled = true;
        }

        private void tmOpenSubtitles_Tick(object sender, EventArgs e)
        {
            if (osi.Info != null)
            {
                tmOpenSubtitles.Stop();
                lblOSText.Text = osi.Info;
                pbOSLoader.Visible = false;
            }
        }

    }
}
